// wtkapplication.cpp
//

#include "config.h"
#include "wtk/wtkapplication.hpp"

using namespace wtk;



Application *Application::current_application{nullptr};



// Application::get_current_application
//
Application &Application::get_current_application ()
{
  if (!current_application)
    WTK_FATAL("no current application");
  return *current_application;
}



// Application::Application
//
Application::Application ()
{
  data_dir = WTK_DATADIR;
  fonts_dir = data_dir / "fonts";
  
  if (!current_application)
    current_application = this;
}



// Application::~Application
//
Application::~Application ()
{
  if (current_application == this)
    current_application = nullptr;
}



// Application::enable_application_layers
//
void Application::enable_application_layers ( const std::vector<std::string> &layers )
{
  wgl_instance.enable_application_layers(layers);
}



// Application::get_enabled_application_layers
//
const std::vector<std::string> &Application::get_enabled_application_layers ()
{
  return wgl_instance.get_enabled_application_layers();
}



// Application::register_display
//
void Application::register_display ( Display &display )
{
  wm.register_display(display);
}



// Application::unregister_display
//
void Application::unregister_display ( Display &display )
{
  wm.unregister_display(display);
}
